<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="logic.newLogic2.Facade3"%>
<%@page import="guiDisplay.*"%>
<%@page import="trailer.*"%>
<%
	String trailer = "";
	MovieData movie = null;
	if ((String) session.getAttribute("currentUser") == null) {
		response.sendRedirect("login.jsp");
	} else {
		movie = Facade3.getInstance().getMovieData(
				request.getParameter("movie"));
		TrailerFinderStub stub = new TrailerFinderStub();
		TrailerFinderStub.FindTrailerByName tmp =
		new TrailerFinderStub.FindTrailerByName();
		tmp.setMovieName(movie.getName());
		TrailerFinderStub.FindTrailerByNameResponse r = stub.findTrailerByName(tmp);
		trailer = r.get_return();

	}
%>
<html>
<head>
<title>secret 4 plus dog</title>
<meta http-equiv="Content-Type"
	content="text/html; charset=windows-1255">
<link href="secret4.css" rel="stylesheet" type="text/css">
</head>

<body bgcolor="#FF6600" dir="ltr">
<a href="login.jsp">Logout</a>    <a href="userPanel.jsp">Main panel</a>
<table height="100%" width="100%" border="0" cellspacing="3"
	cellpadding="2">
	<tr>
		<td width="10%">&nbsp;</td>
		<td valign="top">
		<table height="100%" width="100%" border="0" cellspacing="3"
			cellpadding="2">
			<tr height="20%">
				<td>&nbsp;</td>
			</tr>
			<tr height="80%">
				<td>
				<table align="left" width="100%" border="0" cellspacing="3"
					cellpadding="2">
					<tr>
						<td width="65%" align="left" valign="top">
						<table width="100%" border="0" cellspacing="3" cellpadding="2">
							<tr>
								<td class="title">
								<%
									if (movie != null) {
										out.println(movie.getName());
									}
								%>
								</td>
							</tr>
							<tr>
								<td>
								<table width="100%" border="0" cellspacing="3" cellpadding="2">
									<tr>
										<td>&nbsp;</td>
									</tr>
									<tr>
										<td>
										<form name="movieDisplay" method="post" action="facade.jsp">
										<input type="hidden" name="form" value="rateMovie"> <input
											type="hidden" name="movie"
											value="<%if (movie != null) {
				out.println(movie.getName());
			}%>">
										<table class="bolded" width="100%" border="0" cellspacing="3"
											cellpadding="2">

											<tr>
												<td width="25%">Category:</td>
												<td>&nbsp;</td>
												<td>&nbsp;</td>
												<td>
												<%
													if (movie != null) {
														out.println(movie.getCategory());
													}
												%>
												</td>
											</tr>
											<tr>
												<td>Director:</td>
												<td>&nbsp;</td>
												<td>&nbsp;</td>
												<td>
												<%
													if (movie != null) {
														out.println(movie.getDirector());
													}
												%>
												</td>
											</tr>
											<tr>
												<td>Language:</td>
												<td>&nbsp;</td>
												<td>&nbsp;</td>
												<td>
												<%
													if (movie != null) {
														out.println(movie.getLanguage());
													}
												%>
												</td>
											</tr>
											<tr>
												<td>Length:</td>
												<td>&nbsp;</td>
												<td>&nbsp;</td>
												<td>
												<%
													if (movie != null) {
														out.println(movie.getLength() + " min");
													}
												%>
												</td>
											</tr>
											<tr>
												<td>Rating:</td>
												<td>
												<%
													if (movie != null) {
														out.println(movie.getRating());
													}
												%>
												</td>
												<td>Raters:</td>
												<td>
												<%
													if (movie != null) {
														out.println(movie.getRaters());
													}
												%>
												</td>
											</tr>
											<tr>
											<td colspan="3">Trailer:</td>
												<td>
												<%
													if (movie != null) {
														out.println("<a href=\""+trailer+"\">WATCH TRAILER NOW!!!!<a>");
													}
												%>
												</td>
											</tr>
											<tr>
												<td colspan="4">&nbsp;</td>
											</tr>
											<tr>
												<td align="center" colspan="4"><input type="submit"
													name="submit" value="Rate this movie">
												&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
												&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
												&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <!--input type="button"
													name="Back" value="Back"--></td>
											</tr>
											<tr>
												<td colspan="4">&nbsp;</td>
											</tr>
											<tr>
												<td colspan="2">User Comments:</td>
												<td>&nbsp;</td>
												<td>&nbsp;</td>
											</tr>
											<%
												if (movie != null) {
													for (int i = 0; i < movie.getComments().length; i++) {
														out.println("<tr>");
														out.println("<td class=\"regular\" colspan=\"4\">");
														out
																.println("<table width=\"100%\" bordercolor=\"#FF3300\" border=\"1\"");
														out.println("cellspacing=\"3\" cellpadding=\"2\">");
														out.println("<tr>");
														out.println("<td bgcolor=\"#FFCC00\">");
														out
																.println("<table width=\"100%\" border=\"0\" cellspacing=\"3\"");
														out.println("cellpadding=\"2\">");
														out.println("<tr>");
														out.println("<td>User:</td>");
														out.println("<td>" + movie.getComments()[i].getUser()
																+ "</td>");
														out.println("<td>Rating:</td>");
														out.println("<td>" + movie.getComments()[i].getRating()
																+ "</td>");
														out.println("<td>Date:</td>");
														out.println("<td>" + movie.getComments()[i].getDate()
																+ "</td>");
														out.println("</tr>");
														out.println("</table>");
														out.println("</td>");
														out.println("</tr>");
														out.println("<tr>");
														out.println("<td bgcolor=\"#FF9900\">");
														out
																.println("<table width=\"100%\" border=\"0\" cellspacing=\"3\"");
														out.println("cellpadding=\"2\">");
														out.println("<tr>");
														out
																.println("<td valign=\"top\" width=\"20%\">Description:</td>");
														out.println("<td>");
														out.println("<p>" + movie.getComments()[i].getDescription()
																+ "</p>");
														out.println("</td>");
														out.println("</tr>");
														out.println("</table>");
														out.println("</td>");
														out.println("</tr>");
														out.println("</table>");
														out.println("</td>");
														out.println("</tr>");
													}
												}
											%>
										</table>
										</form>
										</td>
									</tr>
								</table>

								</td>
							</tr>
						</table>
						</td>
						<td valign="top"><img
							src="<%if (movie != null) {
				out.println(movie.getPicture());
			}%>"
							width="300"></td>
					</tr>
				</table>
				</td>
			</tr>
		</table>
		</td>
		<td width="10%">&nbsp;</td>
	</tr>
</table>

</body>
</html>

